package com.huawei.appmarket.service.settings.view.activity;

import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Paint;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.style.ForegroundColorSpan;
import android.text.style.TypefaceSpan;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.appgallery.foundation.ui.framework.cardkit.widget.CardListAdapter;
import com.huawei.hms.support.api.entity.hwid.HwIDConstant.RETCODE;
import o.axe;
import o.axh;
import o.azb;
import o.azc;
import o.cdn;
import o.che;
import o.ckl;
import o.ckl.c;
import o.der.a;
import o.der.b;
import o.der.d;
import o.der.e;
import o.der.f;
import o.der.g;
import o.der.i;
import o.egj;
import o.epv;
import o.eqp;

public class AboutActivity extends BaseActivity {
    private View ʻॱ;
    private TextView ʽॱ = null;
    private TextView ʾ;
    private boolean ʿ = false;
    private TextView ˈ;
    private View ˊˊ;
    private View ˊॱ;
    private View ˋˊ;
    private LinearLayout ˋॱ;
    private View ˏॱ;
    private ImageView ͺ = null;
    private View ॱˊ;
    private TextView ॱˋ;
    private View ॱˎ;
    private TextView ᐝॱ;

    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        getWindow().setBackgroundDrawableResource(a.ᐝ);
        setContentView(g.ॱ);
        ॱ(getString(f.ˎ));
        this.ॱˊ = findViewById(d.ˎ);
        this.ͺ = (ImageView) findViewById(d.ߺ);
        this.ͺ.setImageResource(e.ˎ);
        this.ˋॱ = (LinearLayout) findViewById(d.ॱㆍ);
        this.ˋˊ = findViewById(d.ॱʿ);
        azb.ˏ(this.ˋˊ);
        this.ॱˎ = findViewById(d.ᐝˊ);
        azb.ˏ(this.ॱˎ);
        this.ʻॱ = findViewById(d.ͺˏ);
        azb.ˏ(this.ʻॱ);
        this.ᐝॱ = (TextView) this.ॱˎ.findViewById(d.ﹶ);
        this.ॱˋ = (TextView) this.ʻॱ.findViewById(d.ﹶ);
        this.ˈ = (TextView) this.ॱˎ.findViewById(d.ᵎ);
        this.ʾ = (TextView) this.ʻॱ.findViewById(d.ᵎ);
        ॱ(this.ᐝॱ);
        ॱ(this.ॱˋ);
        ˊ(this.ˈ);
        ˊ(this.ʾ);
        CharSequence string = getString(f.ˋ, new Object[]{Integer.valueOf(getString(f.ˏ)), Integer.valueOf(RETCODE.SMS_RETRIEVER_PARAM_FAILED)});
        ((TextView) findViewById(d.ʼˊ)).setText(string);
        ((TextView) findViewById(d.ˏͺ)).setText(string);
        this.ʽॱ = (TextView) findViewById(d.ˊﾟ);
        String ˎ = cdn.ˎ(this);
        this.ʽॱ.setText(getString(f.ʻ, new Object[]{ˎ}));
        this.ˊॱ = findViewById(d.ʻ);
        this.ˏॱ = findViewById(d.ˊʽ);
        if (!eqp.ᐝ()) {
            this.ˏॱ.setVisibility(8);
            this.ˊॱ.setVisibility(8);
        }
        ᐝ();
        Resources resources = getResources();
        ˏ(resources);
        ˏ(resources.getConfiguration());
    }

    private void ᐝ() {
        CardListAdapter cardListAdapter = new CardListAdapter(this, che.ˎ().ˎ(this, i.ˊ));
        int count = cardListAdapter.getCount();
        for (int i = 0; i < count; i++) {
            View view = cardListAdapter.getView(i, null, null);
            if (i == count - 1) {
                View findViewById = view.findViewById(d.ˊʼ);
                if (findViewById != null) {
                    findViewById.setVisibility(8);
                }
            }
            this.ˋॱ.addView(view);
        }
    }

    private void ॱ(TextView textView) {
        String string;
        String string2;
        String str;
        CharSequence charSequence;
        if (eqp.ᐝ() || axe.ˏ(eqp.ॱ())) {
            string = getString(f.ʿ);
            string2 = getString(f.ᐝʻ);
        } else {
            string = getString(f.ˌ);
            string2 = getString(f.ˋˋ);
        }
        CharSequence spannableString = new SpannableString(getString(f.ˊʿ, new Object[]{string2, string}));
        Paint paint = new Paint();
        paint.setTextSize(textView.getTextSize());
        CharSequence spannableString2;
        if (paint.measureText(spannableString.toString()) > ((float) ((azb.ॱ(this) - azb.ʻ(this)) - azb.ॱॱ(this)))) {
            if (eqp.ᐝ()) {
                string = "\n" + getString(f.ʿ);
            } else {
                string = "\n" + getString(f.ˌ);
            }
            spannableString2 = new SpannableString(getString(f.ˊʿ, new Object[]{string2, string}));
            str = string;
            charSequence = spannableString2;
        } else {
            spannableString2 = spannableString;
            str = string;
            charSequence = spannableString2;
        }
        int indexOf = charSequence.toString().indexOf(string2);
        ckl o_ckl = new ckl(this);
        egj.a aVar = new egj.a(this, 1, false);
        aVar.ˊ(axh.ˊ(this));
        o_ckl.ˏ(aVar.ˋ());
        charSequence.setSpan(o_ckl, indexOf, string2.length() + indexOf, 33);
        charSequence.setSpan(new ForegroundColorSpan(getResources().getColor(a.ˋ)), indexOf, string2.length() + indexOf, 33);
        charSequence.setSpan(new TypefaceSpan(getResources().getString(f.ˍ)), indexOf, string2.length() + indexOf, 33);
        int indexOf2 = charSequence.toString().indexOf(str);
        ckl o_ckl2 = new ckl(this);
        egj.a aVar2 = new egj.a(this, 2, false);
        aVar2.ˎ(axh.ˏ(this));
        o_ckl2.ˏ(aVar2.ˋ());
        charSequence.setSpan(o_ckl2, indexOf2, str.length() + indexOf2, 33);
        charSequence.setSpan(new ForegroundColorSpan(getResources().getColor(a.ˋ)), indexOf2, str.length() + indexOf2, 33);
        charSequence.setSpan(new TypefaceSpan(getResources().getString(f.ˍ)), indexOf2, str.length() + indexOf2, 33);
        indexOf2 = epv.ˋ(this, 4);
        textView.setText(charSequence);
        textView.setLineSpacing((float) indexOf2, 1.0f);
        textView.setMovementMethod(new c());
        textView.setHighlightColor(getApplicationContext().getResources().getColor(a.ʼ));
    }

    private void ˊ(TextView textView) {
        if (textView != null) {
            String string = getString(f.ʻʻ);
            CharSequence spannableString = new SpannableString(string);
            ckl o_ckl = new ckl(this);
            o_ckl.ˏ(new egj.a(this, 3, false).ˋ());
            int indexOf = spannableString.toString().indexOf(string);
            spannableString.setSpan(o_ckl, indexOf, string.length() + indexOf, 33);
            textView.setText(spannableString);
            textView.setMovementMethod(new c());
        }
    }

    private void ˏ(Resources resources) {
        this.ॱˊ.measure(-1, -2);
        int measuredHeight = this.ॱˊ.getMeasuredHeight() - this.ॱˎ.getMeasuredHeight();
        DisplayMetrics displayMetrics = resources.getDisplayMetrics();
        int dimensionPixelSize = getResources().getDimensionPixelSize(b.ˋॱ);
        if (azc.ˎ().ॱ() >= 7) {
            TypedValue typedValue = new TypedValue();
            if (getTheme().resolveAttribute(16843499, typedValue, true)) {
                dimensionPixelSize = TypedValue.complexToDimensionPixelSize(typedValue.data, displayMetrics);
            }
        }
        this.ʻॱ.measure(-1, -2);
        if (((displayMetrics.heightPixels - epv.ˋ(getApplicationContext())) - dimensionPixelSize) - this.ʻॱ.getMeasuredHeight() > measuredHeight) {
            this.ʿ = true;
        } else {
            this.ʿ = false;
        }
    }

    private void ˏ(Configuration configuration) {
        if ((configuration.orientation == 2 && this.ʿ) || (configuration.orientation == 1 && this.ʿ)) {
            this.ʻॱ.setVisibility(0);
            this.ॱˎ.setVisibility(8);
            return;
        }
        this.ʻॱ.setVisibility(8);
        this.ॱˎ.setVisibility(0);
    }

    public void onConfigurationChanged(Configuration configuration) {
        ˏ(getResources());
        ˏ(configuration);
        ͺ();
        super.onConfigurationChanged(configuration);
    }

    private void ͺ() {
        this.ˊˊ.setPaddingRelative(azb.ʻ(this) - azb.ˊ(this), this.ˊˊ.getPaddingTop(), azb.ॱॱ(this) - azb.ˏ(this), this.ˊˊ.getPaddingBottom());
        this.ˋˊ.setPaddingRelative(azb.ʻ(this), this.ˋˊ.getPaddingTop(), azb.ॱॱ(this), this.ˋˊ.getPaddingBottom());
        this.ॱˎ.setPaddingRelative(azb.ʻ(this), this.ॱˎ.getPaddingTop(), azb.ॱॱ(this), this.ॱˎ.getPaddingBottom());
        this.ʻॱ.setPaddingRelative(azb.ʻ(this), this.ʻॱ.getPaddingTop(), azb.ॱॱ(this), this.ʻॱ.getPaddingBottom());
        this.ˋॱ.removeAllViews();
        ᐝ();
    }

    public void onPause() {
        super.onPause();
    }

    public void onDestroy() {
        super.onDestroy();
        if (getActionBar() != null) {
            getActionBar().show();
        }
    }

    public void ॱ(String str) {
        ॱˊ();
        super.ॱ(str);
    }

    private void ॱˊ() {
        this.ˊˊ = findViewById(d.ʿᐝ);
        this.ˊˊ.setPaddingRelative(azb.ʻ(this) - azb.ˊ(this), this.ˊˊ.getPaddingTop(), azb.ॱॱ(this) - azb.ˏ(this), this.ˊˊ.getPaddingBottom());
    }
}
